package com.jyserver.common.AutoCode.jybaits.element.pc.From;

import com.jyserver.common.utils.HelpUtils;

public class Input {
    public static String getStyle(String label, Object prop, String key)  {
        String validate = "";
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
//            validate = "v-validate=\"'required|" + prop + "'\" ";
        } else {
            prop = "";
        }
        try {
            return "<el-form-item label=\"" + label + "：\" :label-width=\"formLabelWidth\" " + prop + ">\n" +"<el-col :xs=\"24\" :sm=\"22\" :md=\"20\" :lg=\"18\" :xl=\"15\">"+
                    "          <el-input v-model=\"Dataform." + key + "\" " + validate + " placeholder=\""+"请输入" + label + "\" autocomplete=\"off\"></el-input>\n" +
                    "        </el-col></el-form-item>";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  "";
    }


    public static String getStyleView(String label, Object prop, String key)  {
        String validate = "";
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
//            validate = "v-validate=\"'required|" + prop + "'\" ";
        } else {
            prop = "";
        }
        try {
            return "<el-form-item label=\"" + label + "：\" :label-width=\"formLabelWidthView\" >\n" +
                    "          {{Viewform." + key + "}}\n" +
                    "     </el-form-item>";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  "";
    }


    public static String getautdate(String label, Object prop, String key)  {
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
        } else {
            prop = "";
        }
        try {
            return "<el-form-item label=\""+label+"：\" :label-width=\"formLabelWidth\"  "+prop+"><el-date-picker\n" +
                    "    v-model=\"Dataform."+key+"\"\n" +
                    "    type=\"date\"\n" +
                    "    placeholder=\"选择日期\">\n" +
                    "    </el-date-picker></el-form-item>";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  "";
    }

    public static String getnumber(String label, Object prop, String key)  {
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
        } else {
            prop = "";
        }
        try {
            return "<el-form-item label=\""+label+"：\" :label-width=\"formLabelWidth\"  "+prop+"><el-input-number "+
                    "    v-model=\"Dataform."+key+"\"\n" +
                    "  ></el-input-number></el-form-item>";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  "";
    }

}
